<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: libowu
  Date: 18-10-18
  Time: 上午11:14
  To change this template use File | Settings | File Templates.
--%>
<%--<%@ page contentType="text/html;charset=UTF-8" language="java" %>--%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<html>
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <!-- 最新版本的 Bootstrap 核心 CSS 文件 -->
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css" rel="stylesheet">

    <script src="https://cdn.jsdelivr.net/npm/jquery@1.12.4/dist/jquery.min.js"></script>
    <!-- 加载 Bootstrap 的所有 JavaScript 插件。你也可以根据需要只加载单个插件。 -->
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/js/bootstrap.min.js"></script>

    <style type="text/css">
        body{
            background: rgba(0,0,0,0);
        }
        .parent{
            margin: 0 auto;
            height: 100%;
            width: 50%;
            position: absolute;
            left: 25%;
            right: 25%;
            top: 0px;
            background: rgba(0,0,0,0.3);
        }

        .head{
            margin: 0 auto;
            height: 40%;
            width: 100%;
            overflow: hidden;
            text-align: center;
            align-content: center;
        }

        .head img{
            width: 100%;
        }

        .inputInfo{
            height: 50%;
            width: 100%;
            padding: 40px;
        }

        .inputInfo .input-group{
            height: 50px;
            margin-bottom: 40px;
            margin-left: 40px;
            margin-right: 40px;
        }
        .inputInfo .input-group span{
            height: 50px;
        }
        .inputInfo .input-group input{
            height: 50px;
        }

        .option{
            width: 100%;
            text-align: center;
            align-content: center;
        }

        .choose{
            width: 100%;
            padding-left: 40px;
            padding-right: 40px;
            color: white;
        }

        .choose span{
            margin-right: 40px;
            font-size: 16px;
        }
        .choose span:first-child{
            margin-right: 20px;
        }

        .al{
            height: 60px;
            width: 200px;
            position: absolute;
            top: 20px;
            left: 46%;
            background: green;
            border-radius: 10px;
            color: white;
            text-align: center;
            align-content: center;
            font-size: 16px;
            line-height: 60px;
            display: none;
        }

    </style>
</head>
<body>

<div class="parent">
    <div class="head">
        <img src="/img/appLogo/ysn.jpeg">
    </div>


    <form action="/futer/addApplicationSubmit" method="post" name="form">

        <div class="inputInfo">
            <div class="input-group">
                <span class="input-group-addon" id="basic-addon3">应用名称</span>
                <c:if test="${appInfo!=null}">
                    <input type="text" class="form-control" id="basic-url1" aria-describedby="basic-addon3" required="required" name="appName" value="${appInfo.appname}" placeholder="名字任意">
                </c:if>

                <c:if test="${appInfo==null}">
                    <input type="text" class="form-control" id="basic-url1" aria-describedby="basic-addon3" required="required" name="appName" placeholder="名字任意">
                </c:if>
            </div>


            <div class="input-group">
                <span class="input-group-addon" id="basic-addon5">链接地址</span>

                <c:if test="${appInfo!=null}">
                    <input type="text" class="form-control" id="basic-url3" aria-describedby="basic-addon3" required="required" name="appUrl" value="${appInfo.appurl}" placeholder="格式：/控制器/具体链接">
                </c:if>

                <c:if test="${appInfo==null}">
                    <input type="text" class="form-control" id="basic-url3" aria-describedby="basic-addon3" required="required" name="appUrl" placeholder="格式：/控制器/具体链接">
                </c:if>

            </div>

            <div class="input-group">
                <span class="input-group-addon" id="basic-addon6">图标地址</span>

                <c:if test="${appInfo!=null}">
                    <input type="text" class="form-control" id="basic-url4" aria-describedby="basic-addon3" required="required" name="appLogo" value="${appInfo.appimg}" placeholder="图片请放到appLogo下">
                </c:if>

                <c:if test="${appInfo==null}">
                    <input type="text" class="form-control" id="basic-url4" aria-describedby="basic-addon3" required="required" name="appLogo" placeholder="图片请放到appLogo下">
                </c:if>

            </div>

            <div class="choose">
               <span>
                   添加值应用栏
               </span>


                <c:if test="${appInfo!=null}">
                    <c:if test="${appInfo.hide==1}">
                        <span>
                        <label >
                            <input type="radio" name="type"  value="1" checked/>是
                        </label>
                        </span>

                        <span>
                            <label >
                            <input type="radio" name="type"  value="0" />否
                        </label>
                        </span>
                    </c:if>

                    <c:if test="${appInfo.hide==0}">
                        <span>
                        <label >
                            <input type="radio" name="type"  value="1" />是
                        </label>
                        </span>

                        <span>
                            <label >
                            <input type="radio" name="type"  value="0" checked/>否
                        </label>
                        </span>
                    </c:if>
                </c:if>

                <c:if test="${appInfo.hide==null}">
                    <span>
                        <label >
                            <input type="radio" name="type"  value="1" checked/>是
                        </label>
                    </span>

                    <span>
                            <label >
                            <input type="radio" name="type"  value="0" />否
                        </label>
                    </span>
                </c:if>

            </div>
        </div>


        <div class="option">
            <button type="submit" class="btn btn-success">确定保存</button>
        </div>

    </form>

</div>

<div class="al" id="al">
    保存成功
</div>

<script type="text/javascript">

    function hiddenAl(){
        (document.getElementById("al")).style.display="none";
    }

    if (${statu!=null}){
        setTimeout(hiddenAl,1000)
        if ("${statu}"==1){
            (document.getElementById("al")).style.backgroundColor="green";
            (document.getElementById("al")).innerText="添加成功";
            (document.getElementById("al")).style.display="block";
            parent.reFreshApp('添加');
        }else if ("${statu}"==-10) {
            (document.getElementById("al")).style.backgroundColor="red";
            (document.getElementById("al")).innerText="应用已存在";
            (document.getElementById("al")).style.display="block";
        }else if ("${statu}"==-20) {
            (document.getElementById("al")).style.backgroundColor="red";
            (document.getElementById("al")).innerText="存在地址相同的应用";
            (document.getElementById("al")).style.display="block";
        }
    }

    if ('${login}'=='login'){
        parent.sengToLogin();
    }

</script>
</body>
</html>
